package cn.cdeden.knowledge.service.impl;

import cn.cdeden.knowledge.domain.SysSchedule;
import cn.cdeden.knowledge.domain.SysSchedulePermissions;
import cn.cdeden.knowledge.domain.dto.SysSchedulePermissionsDto;
import cn.cdeden.knowledge.mapper.SysSchedulePermissionsMapper;
import cn.cdeden.knowledge.service.SysSchedulePermissionsService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class SysSchedulePermissionsServiceImpl extends ServiceImpl<SysSchedulePermissionsMapper, SysSchedulePermissions> implements SysSchedulePermissionsService {


    @Override
    public List<SysSchedulePermissionsDto> getAllPermissions() {

        return getBaseMapper().getAllPermissions();
    }

    @Override
    public List<SysSchedule> checkPermissions(Long userId) {
        return getBaseMapper().checkPermissions(userId);
    }

    @Override
    public Boolean checkPermissionsById(Long scheduleId, Long userId, String detailsName) {
        List<SysSchedule> sysSchedules = getBaseMapper().checkPermissionsById(scheduleId, userId, detailsName);
        if (!sysSchedules.isEmpty()) {
            return true;
        }
        return false;
    }
}
